package com.yanqu.road.server.manger.activity.recycle;

import com.yanqu.road.entity.activity.ActivityInfo;
import com.yanqu.road.entity.activity.ActivityItemRecycleData;
import com.yanqu.road.entity.activity.daomu.config.DaoMuActivityConfig;
import com.yanqu.road.entity.activity.daomu.config.DaoMuCrowbarBoxConfig;
import com.yanqu.road.entity.activity.doublespring.DoubleSpringActivityConfig;
import com.yanqu.road.entity.config.goods.GoodsInfo;
import com.yanqu.road.entity.config.goods.OpenGoodsBagResult;
import com.yanqu.road.entity.enums.eActivityType;
import com.yanqu.road.entity.enums.eGoodsType;
import com.yanqu.road.entity.enums.eLogMoneyType;
import com.yanqu.road.entity.enums.eMailType;
import com.yanqu.road.entity.player.UserBagItem;
import com.yanqu.road.server.gameplayer.module.player.CurrencyModule;
import com.yanqu.road.server.logic.mail.MailManager;
import com.yanqu.road.server.manger.MultipleLanguageMgr;
import com.yanqu.road.server.manger.ServerLanguageMgr;
import com.yanqu.road.server.manger.activity.NormalActivityMgr;
import com.yanqu.road.server.manger.activity.daomu.DaoMuActivityMgr;
import com.yanqu.road.server.manger.activity.doublespring.DoubleSpringActivityMgr;
import com.yanqu.road.server.manger.activity.drawPictures.DrawPicturesActivityMgr;
import com.yanqu.road.server.manger.config.GoodsBagMgr;
import com.yanqu.road.server.manger.config.GoodsMgr;
import com.yanqu.road.server.manger.player.UserMgr;
import com.yanqu.road.utils.property.Property;
import com.yanqu.road.utils.property.PropertyHelper;

import java.math.BigInteger;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class DoubleSpringRecycleStrategy extends AbstractItemRecycleStrategy {

    @Override
    public void markNeedRecycleItem() {
        List<ActivityInfo> activityList = NormalActivityMgr.getOpenActivityInfoList(eActivityType.DoubleSpring.getValue());
        for (ActivityInfo activityInfo : activityList) {
            if (activityInfo != null) {
                //回收时间
                long recycleTime = activityInfo.getEndShowTime() * 1000L + 600 * 1000;
                //回收的道具ID
                DoubleSpringActivityConfig doubleSpringActivityConfig = DoubleSpringActivityMgr.getActivityConfig(activityInfo.getActivityId());
                if (doubleSpringActivityConfig != null) {
                    Property property = doubleSpringActivityConfig.getDoubleSpringItemCost();
                    for (int goodsId : property.getGoods().keySet()) {
                        List<String> paramList = new ArrayList<>();
                        paramList.add(activityInfo.getActivityName());
                        ActivityItemRecycleMgr.addRecycleItemData(goodsId, activityType, 1, recycleTime, paramList);
                    }
                }
            }
        }
    }

    @Override
    protected void initActivityType() {
        activityType = eActivityType.DoubleSpring.getValue();
    }

    @Override
    protected void doRecycle(long userId, ActivityItemRecycleData data) {
        this.useGiftItem(userId, data.getItemId(), data.getParamList().get(0));
    }

    @Override
    public boolean isActivityRunning() {
        return false;
    }
}
